#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
const int N = 1e5 + 10;
long long arr[N];
int n;
long long b[N];
long long fun(long long n)
{
	int i = 0;
	while (n)
	{
		b[i++] = n % 2;
		n /= 2;
	}
	i--;
	long long sum = 0;
	int n1 = i;
	for (int j = 0; j <= i; j++) {
		sum += b[j] * pow(2, n1--);
	}
	return sum;
}
int main()
{
	cin >> n;
	long long sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
		sum += fun(arr[i]);
	}
	cout << sum << endl;
	return 0;
}